import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/shouye',
    name: 'shouye',
    component: () => import( '../views/shouye.vue'),
  },
  {
    path: '/fenlei',
    name: 'fenlei',
    component: () => import( '../views/fenlei.vue'),
    children:[
      {
        path: '/caomei',
        name: 'caomei',
        component: () => import( '../components/pinglei/erji/caomei.vue'),
      },
      {
        path: '/rexiao',
        name: 'rexiao',
        component: () => import( '../components/pinglei/erji/rexiao.vue'),
      },
      {
        path: '/zhaopai',
        name: 'zhaopai',
        component: () => import( '../components/pinglei/erji/zhaopai.vue'),
      },
      {
        path: '/ganju',
        name: 'ganju',
        component: () => import( '../components/pinglei/erji/ganju.vue'),
      },
      {
        path: '/pingguo',
        name: 'pingguo',
        component: () => import( '../components/pinglei/erji/pingguo.vue'),
      },
      {
        path: '/puti',
        name: 'puti',
        component: () => import( '../components/pinglei/erji/puti.vue'),
      },
      {
        path: '/xianqie',
        name: 'xianqie',
        component: () => import( '../components/pinglei/erji/xianqie.vue'),
      },
      {
        path: '/ganguo',
        name: 'ganguo',
        component: () => import( '../components/pinglei/erji/ganguo.vue'),
      },
      {
        path: '/xigua',
        name: 'xigua',
        component: () => import( '../components/pinglei/erji/xigua.vue'),
      },
      {
        path: '/redaiguo',
        name: 'redaiguo',
        component: () => import( '../components/pinglei/erji/redaiguo.vue'),
      },
      {
        path: '/guolan',
        name: 'guolan',
        component: () => import( '../components/pinglei/erji/guolan.vue'),
      },
      {
        path: '/coudan',
        name: 'coudan',
        component: () => import( '../components/pinglei/erji/coudan.vue'),
        beforeEnter(to,from,next){
          console.log(to)
          console.log(from)
          
         alert("当前页面是独享页面")
          next("/rexiao")
        }
      },
      {
        path: '/quanguo',
        name: 'quanguo',
        component: () => import( '../components/pinglei/erji/quanguo.vue'),
      },
      {
        path:'/fenlei',
        redirect:'/rexiao',
      },
    ]
  },
  {
    path: '/chishenme',
    name: 'chishenme',
    component: () => import( '../views/chishenme.vue'),
  },
  {
    path: '/gouwu',
    name: 'gouwu',
    component: () => import( '../views/gouwu.vue')
  },
  {
    path: '/wode',
    name: 'wode',
    component: () => import( '../views/wode.vue'),
  },
  {
    path: '/fuzhu',
    name: 'fuzhu',
    component: () => import( '../views/fuzhu.vue'),
  },
  {
    path: '/youhui',
    name: 'youhui',
    component: () => import( '../views/tiaozhuan/youhui.vue'),
  },
  {
    path: '/baopin',
    name: 'baopin',
    component: () => import( '../views/tiaozhuan/baopin.vue'),
  },
  {
    path: '/quan',
    name: 'quan',
    component: () => import( '../views/tiaozhuan/quan.vue'),
  },
  {
    path: '/huiyuan',
    name: 'huiyuan',
    component: () => import( '../views/tiaozhuan/huiyuan.vue'),
  },
  {
    path: '/denglu',
    name: 'denglu',
    component: () => import( '../views/tiaozhuan/denglu.vue'),
  },
  {
    path: '/ceshi',
    name: 'ceshi',
    component: () => import( '../views/ceshi.vue'),
  },
  {
    path:'/',
    redirect:'shouye',
  },
  {
    path: '*',
    name: 'no',
    component: () => import( '../views/no.vue')
  },
]


const router = new VueRouter({
  // mode: 'history',
  base: process.env.BASE_URL,
  routes
})

// router.beforeEach((to,from,next)=>{
//   console.log("to",to)
//   console.log("from",from)


//   if(to.path=="/quanguo"){
//     next()
//   }else{
//     alert("您没有登录请您登录后在试！！！")
//     next("/quanguo")
//   }
// })



export default router
